package com.edu.hre.db.service;
 
import java.util.Collection;
import java.util.List;

import com.edu.hre.struts.form.recruit.CandidateForm;
 

public interface BaseService {
	public static final String BEAN_NAME="baseService"; 
	
	public <T> T getPojo(int pId, Class<T> _class);
	public <T> List<T> getAllPojos(Class<T> _class);
	public <T> List<T> getAllPojos(String[] orderBy, Boolean[] desc, Class<T> _class);
	public <T> List<T> getPojos(String colName, int compare, Object colValue, Class<T> _class);
	public <T> List<T> getPojos(String colName, int compare, Object colValue, String[] orderBy, Boolean[] desc, int limit, int offset, Class<T> _class);
	public <T> List<T> getPojosAnd(String[] colNames, int[] compares, Object[] colValues, String[] orderBy, Boolean[] desc, int limit, int offset, Class<T> _class);
	public <T> List<T> getPojosOr(String[] colNames, int[] compares, Object[] colValues, String[] orderBy, Boolean[] desc, int limit, int offset, Class<T> _class);
	public <T> List<T> getPojosIn(String colName, Object[] colValues, String[] orderBy, Boolean[] desc, int limit, int offset, Class<T> _class);
	
	public <T> boolean saveOrUpdate(Collection<T> pojos);
	public <T> boolean saveOrUpdate(T pojo);
	public <T> boolean save(Collection<T> pojos) ;
	public <T> boolean save(T pojo) ;
	public int update(String tbName, String[] colNames, Object[] colValues, String[] whereColNames, int[] whereCompares, Object[] whereColValues, String andOr);
	public <T> boolean update(Collection<T> pojos) ;
	public <T> boolean update(T pojo) ;
	
	public <T> int sumByColumns(String[] colNames, int[] compares, Object[] colValues, String colSumName, Class<T> _class);
	public <T> int sumByColumns(String colNames, int compares, Object colValues, String colSumName, Class<T> _class);
	public <T> int sumByColumnsOr(String[] colNames, int[] compares, Object[] colValues, String colSumName, Class<T> _class) throws Exception;
	public <T> int countByColumns(String[] colNames, int[] compares, Object[] colValues, String colCountName, Class<T> _class);
	public <T> int countByColumns(String colNames, int compares, Object colValues, String colCountName, Class<T> _class);
	public <T> int countByColumnsOr(String[] colNames, int[] compares, Object[] colValues, String colCountName, Class<T> _class);
	
	public <T> T getFirstPojo(String colName, int compare, Object colValue, Class<T> _class);
	public <T> T getFirstPojo(String colName, int compare, Object colValue, String[] orderBy, Boolean[] desc, int offset, Class<T> _class);
	public <T> T getFirstPojoOr(String[] colNames, int[] compares, Object[] colValues, Class<T> _class);
	public <T> T getFirstPojoOr(String[] colNames, int[] compares, Object[] colValues,  String[] orderBy, Boolean[] desc, int offset,Class<T> _class);
	public <T> T getFirstPojoAnd(String[] colNames, int[] compares, Object[] colValues, Class<T> _class);
	public <T> T getFirstPojoIn(String colName, Object[] colValues, Class<T> _class);
	public <T> T getFirstPojoAnd(String[] colNames, int[] compares, Object[] colValues,  String[] orderBy, Boolean[] desc, int offset,Class<T> _class);
	public <T> T getFirstPojoIn(String colName, Object[] colValues, String[] orderBy, Boolean[] desc, int offset, Class<T> _class);
	
	public <T> boolean deletePojo(T pojo); 
	public <T> boolean deletePojos(Collection<T> pojos);
	public <T> boolean deleteFirstPojo(String colName, int compare, Object colValue, String[] orderBy, Boolean[] desc, int offset, Class<T> _class) ;
	public <T> boolean deleteFirstPojo(int pId, Class<T> _class);
	public <T> int deletePojos(String sqlCommand, Object...params); 
	public List<Object[]> listArrayObject(String sql, int limit, int offset, Object...params);
	public List<CandidateForm> listRecommendedCandidates(final String procedureName, Object[] params);
}
